package tt.com.bodybeautymanager.controller;

import com.baomidou.mybatisplus.extension.api.R;
import javafx.scene.shape.VLineTo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import tt.com.bodybeautymanager.Vo.cosmeticVo;
import tt.com.bodybeautymanager.service.DeadCosmeticAddService;
import tt.com.bodybeautymanager.service.DeadCosmeticService;
import tt.com.bodybeautymanager.service.PlasticSurgerysuccess;
import tt.com.common.enums.Status;
import tt.com.common.model.DeadCosmetic;
import tt.com.common.model.DeadCosmeticStaff;
import tt.com.common.util.CommonResult;
import tt.com.common.util.PageUtil;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping(value = "dead/cosmetic")
public class DeadCosmeticController {
    @Autowired
    private DeadCosmeticService deadCosmeticService;
    @Autowired
    private DeadCosmeticAddService deadCosmeticAddService;
    @Autowired
    private PlasticSurgerysuccess plasticSurgerysuccess;

    //显示整容反腐的信息
    @PostMapping(value = "show/cosmetic")
    public ResponseEntity showDeadCosmetic(@RequestBody cosmeticVo vo, HttpServletRequest request) {
        CommonResult result = deadCosmeticService.showDeadCosmetic(vo.getPageUtil());
        return new ResponseEntity(result,HttpStatus.valueOf(result.getStatus()));
    }

    //根据id进行逻辑删除
    @PostMapping(value = "delete/cosmetic")
    public ResponseEntity deleteById(@RequestBody DeadCosmetic deadCosmetic, HttpServletRequest request) {
        CommonResult result = deadCosmeticService.deleteDeadCosmetic(deadCosmetic);
        return new ResponseEntity(result,HttpStatus.valueOf(result.getStatus()));
    }

    //根据id进行对整容反腐信息的修改
    @PostMapping(value = "update/cosmetic")
    public ResponseEntity updateById(@RequestBody DeadCosmetic deadCosmetic, HttpServletRequest request) {
        CommonResult result = deadCosmeticService.updateCosmetic(deadCosmetic);
        return new ResponseEntity(result,HttpStatus.valueOf(result.getStatus()));
    }

    //刷新
    @PostMapping(value = "ref/cosmetic")
    public ResponseEntity refreshDeadCosmetic(@RequestBody PageUtil pageUtil, HttpServletRequest request) {
        CommonResult result = deadCosmeticService.refreshDeadCosmetic(pageUtil);
        return new ResponseEntity(result, HttpStatus.valueOf(result.getStatus()));
    }

    //查询
    @PostMapping(value = "select/cosmetic")
    public ResponseEntity selectDeadCosmetic(@RequestBody cosmeticVo vo,HttpServletRequest request){
        CommonResult result = deadCosmeticService.selectCosmetic(vo.getDeadCosmetic(),vo.getPageUtil());
        return new ResponseEntity(result,HttpStatus.valueOf(result.getStatus()));
    }

    //添加服务
    @PostMapping(value = "add/cosmeticstaff")
    public ResponseEntity addDeadCosmeticStaff(@RequestBody DeadCosmeticStaff deadCosmeticStaff,HttpServletRequest request){
        CommonResult result = deadCosmeticAddService.addService(deadCosmeticStaff, deadCosmeticStaff.getCreateUserId(), deadCosmeticStaff.getStaffId());
        return new ResponseEntity(result,HttpStatus.valueOf(result.getStatus()));

    }
    //修改整容时间
    @PostMapping(value = "update/pssuccess")
    public ResponseEntity updatepssuccess(@RequestBody DeadCosmetic deadCosmetic,HttpServletRequest request){
        CommonResult result = plasticSurgerysuccess.updatesuccesstime(deadCosmetic,deadCosmetic.getLastUpdateTime(),deadCosmetic.getLastUpdateUserId());
        return new ResponseEntity(result,HttpStatus.valueOf(result.getStatus()));
    }
}